/*    */ package blockbuster.components.meta;
/*    */ 
/*    */ import blockbuster.components.BedrockComponentBase;
/*    */ import blockbuster.components.IComponentParticleInitialize;
/*    */ import blockbuster.emitter.BedrockEmitter;
/*    */ import blockbuster.emitter.BedrockParticle;
/*    */ import blockbuster.math.molang.MolangException;
/*    */ import blockbuster.math.molang.MolangParser;
/*    */ import com.google.gson.JsonElement;
/*    */ import com.google.gson.JsonObject;
/*    */ 
/*    */ public class BedrockComponentLocalSpace extends BedrockComponentBase implements IComponentParticleInitialize {
/*    */   public boolean position;
/*    */   public boolean rotation;
/*    */   public boolean scale;
/*    */   public boolean scaleBillboard;
/*    */   public boolean direction;
/*    */   public boolean acceleration;
/*    */   public boolean gravity;
/*    */   public float linearVelocity;
/*    */   public float angularVelocity;
/*    */   
/*    */   public BedrockComponentBase fromJson(JsonElement elem, MolangParser parser) throws MolangException {
/* 24 */     if (!elem.isJsonObject()) return super.fromJson(elem, parser);
/*    */     
/* 26 */     JsonObject element = elem.getAsJsonObject();
/*    */     
/* 28 */     if (element.has("position")) this.position = element.get("position").getAsBoolean(); 
/* 29 */     if (element.has("rotation")) this.rotation = element.get("rotation").getAsBoolean(); 
/* 30 */     if (element.has("scale")) this.scale = element.get("scale").getAsBoolean(); 
/* 31 */     if (element.has("scale_billboard")) this.scaleBillboard = element.get("scale_billboard").getAsBoolean(); 
/* 32 */     if (element.has("direction")) this.direction = element.get("direction").getAsBoolean(); 
/* 33 */     if (element.has("acceleration")) this.acceleration = element.get("acceleration").getAsBoolean(); 
/* 34 */     if (element.has("gravity")) this.gravity = element.get("gravity").getAsBoolean(); 
/* 35 */     if (element.has("linear_velocity")) this.linearVelocity = element.get("linear_velocity").getAsFloat(); 
/* 36 */     if (element.has("angular_velocity")) this.angularVelocity = element.get("angular_velocity").getAsFloat();
/*    */     
/* 38 */     return super.fromJson((JsonElement)element, parser);
/*    */   }
/*    */ 
/*    */   
/*    */   public JsonElement toJson() {
/* 43 */     JsonObject object = new JsonObject();
/*    */     
/* 45 */     if (this.position) object.addProperty("position", Boolean.valueOf(true)); 
/* 46 */     if (this.rotation) object.addProperty("rotation", Boolean.valueOf(true)); 
/* 47 */     if (this.scale) object.addProperty("scale", Boolean.valueOf(true)); 
/* 48 */     if (this.scaleBillboard) object.addProperty("scale_billboard", Boolean.valueOf(true)); 
/* 49 */     if (this.direction) object.addProperty("direction", Boolean.valueOf(true)); 
/* 50 */     if (this.acceleration) object.addProperty("acceleration", Boolean.valueOf(true)); 
/* 51 */     if (this.gravity) object.addProperty("gravity", Boolean.valueOf(true)); 
/* 52 */     if (this.linearVelocity != 0.0F) object.addProperty("linear_velocity", Float.valueOf(this.linearVelocity)); 
/* 53 */     if (this.angularVelocity != 0.0F) object.addProperty("angular_velocity", Float.valueOf(this.angularVelocity));
/*    */     
/* 55 */     return (JsonElement)object;
/*    */   }
/*    */ 
/*    */   
/*    */   public void apply(BedrockEmitter emitter, BedrockParticle particle) {
/* 60 */     particle.relativePosition = this.position;
/* 61 */     particle.relativeRotation = this.rotation;
/* 62 */     particle.relativeScale = this.scale;
/* 63 */     particle.relativeScaleBillboard = this.scaleBillboard;
/* 64 */     particle.relativeDirection = this.direction;
/* 65 */     particle.relativeAcceleration = this.acceleration;
/* 66 */     particle.gravity = this.gravity;
/* 67 */     particle.linearVelocity = this.linearVelocity;
/* 68 */     particle.angularVelocity = this.angularVelocity;
/*    */     
/* 70 */     particle.setupMatrix(emitter);
/*    */   }
/*    */ 
/*    */   
/*    */   public int getSortingIndex() {
/* 75 */     return 6;
/*    */   }
/*    */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\blockbuster\components\meta\BedrockComponentLocalSpace.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */